#!/bin/bash

source ./config.sh

mkdir $INPUT_FILE_DIR  >& /dev/null
mkdir $OUTPUT_FILE_DIR  >& /dev/null
mkdir $OUTPUT_LOG_FILE_DIR  >& /dev/null
mkdir $OUTPUT_TIME_FILE_DIR  >& /dev/null
mkdir $OUTPUT_PHY_FILE_DIR  >& /dev/null
mkdir $OUTPUT_ERR_FILE_DIR  >& /dev/null
mkdir $OUTPUT_HTML_FILE_DIR  >& /dev/null
mkdir $JOB_FILE_DIR  >& /dev/null

rm -f pythia_event.data >& /dev/null
ln -sf ../SimplifiedCalo/pythia_event.data pythia_event.data >& /dev/null

ln -sf ./root/drawHs ./drawHs

for index in $(seq 0 $((${#B_APPS[@]} - 1)))
do
  ### produce input file ###
  ${PWD}/InputInit.sh ${B_APPS[$index]} ${B_ENERGYS[$index]} ${B_SAMPLES[$index]} ${B_BFIELDS[$index]} ${B_EVENTS[$index]}

  ### produce job file ###
  for th_i in ${THREADS[@]}
  do
    ${PWD}/JobInit.sh ${B_APPS[$index]} ${B_ENERGYS[$index]} ${B_SAMPLES[$index]} ${B_BFIELDS[$index]} ${B_PYLISTS[$index]} $th_i
  done
done


#for app_i in ${APPS[@]}
#do
#
  #for energy_i in ${ENERGYS[@]}
  #do
#
    #for input_i in $(seq 0 $((${#INPUT_SAMPLES[@]} - 1)))     
    #do
      #### produce input file ###
      #${PWD}/InputInit.sh $app_i $energy_i ${INPUT_SAMPLES[$input_i]} ${INPUT_BFS[$input_i]}
#
      #### produce job file ###
      #for th_i in ${THREADS[@]}
      #do
        #${PWD}/JobInit.sh $app_i $energy_i ${INPUT_SAMPLES[$input_i]} ${INPUT_BFS[$input_i]} $th_i
      #done
    #done
  #done
#done
